TOPDIR= ../../../..
MKSPEC= $(TOPDIR)/mkspec

CFLAGS+= -Werror -Wno-unknown-pragmas

SRCS= common.c

#PROG= in.routed
#SRCS+= if.c input.c main.c output.c parms.c radix.c rdisc.c table.c trace.c

PROG= rtquery
SRCS+= rtquery.c

LDADD+= -lkstat -lresolv

include $(MKSPEC)/dilos.prog.mk

# rtquery.c

ROUTEDPROG=	in.routed
ROUTEDOBJS=	common.o if.o input.o main.o output.o parms.o radix.o \
                rdisc.o table.o trace.o
ROUTEDSRCS=	$(ROUTEDOBJS:.o=.c)
RTQUERYPROG=	rtquery
RTQUERYOBJS=	common.o rtquery.o
RTQUERYSRCS=	$(RTQUERYOBJS:.o=.c)
POFILEOBJS=	$(ROUTEDOBJS) $(RTQUERYOBJS)	

#PROG=		$(ROUTEDPROG) $(RTQUERYPROG)
#SRCS=		$(ROUTEDSRCS) $(RTQUERYSRCS)

MANIFEST=		route.xml
SVCMETHOD=		svc-route

#include		../../../Makefile.cmd
#include		../../../Makefile.cmd.64
#include		../../../Makefile.ctf

ROOTMANIFESTDIR=	$(ROOTSVCNETWORKROUTING)

#
# in.routed uses ancillary data features available through
# the Open Group's Networking Services standard.  The following
# pre-processor definitions enable these features.
#
_D_XOPEN_EXTN = -D_XOPEN_SOURCE=500 -D__EXTENSIONS__

# Turning on __EXTENSIONS__ breaks lint, and we need __EXTENSIONS__.
# This is really a lint problem, so around the breakage.
LINTFLAGS += -erroff=E_FUNC_DECL_VAR_ARG2 -erroff=E_INCONS_VAL_TYPE_DECL2 \
	     -erroff=E_INCONS_ARG_DECL2 -erroff=E_INCONS_ARG_USED2

CPPFLAGS +=	$(_D_XOPEN_EXTN)
CFLAGS +=	$(CCVERBOSE)
CERRWARN +=	-_gcc=-Wno-parentheses
CERRWARN +=	-_gcc=-Wno-uninitialized
LDLIBS +=	-lxnet
CLEAN_FILES +=	$(ROUTEDOBJS) $(RTQUERYOBJS)
CLOBBERFILES +=	$(ROUTEDPROG) $(RTQUERYPROG)
#
# Message catalog
#
POFILE=		in.routed.po
POFILES=  $(POFILEOBJS:.o=.po)
#
$(ROUTEDPROG):=	LDLIBS += -lkstat
lint	:=	LDLIBS += -lkstat

# This needs to be done because of SPARC/x86 differences.  On x86,
# double has required alignment of only 4 bytes, but on SPARC it's 8
# bytes.  This means that sockaddr_in can be casted to
# sockaddr_storage without complaint on x86, but requires a
# suppression directive on SPARC.
LINTFLAGS +=	-erroff=E_SUPPRESSION_DIRECTIVE_UNUSED

CTFCONVERT_HOOK = && $(CTFCONVERT_O)
CTFMERGE_HOOK = && $(CTFMERGE) -L VERSIONCTF -o $@ $(ROUTEDOBJS)
$(ROUTEDOBJS) := CFLAGS += $(CTF_FLAGS)
$(RTQUERYOBJS) := CFLAGS += $(CTF_FLAGS)

#.KEEP_STATE:

#.PARALLEL: $(ROUTEDPROG) $(RTQUERYOBJS)

#all:	$(PROG)

$(POFILE): $(POFILES)
	$(RM) $@
	cat $(POFILES) > $@

#$(ROUTEDPROG):	$(ROUTEDOBJS)
#	$(LINK.c) -o $@ $(ROUTEDOBJS) $(LDLIBS) $(CTFMERGE_HOOK)
#	$(POST_PROCESS)

#$(RTQUERYPROG): $(RTQUERYOBJS)
#	$(LINK.c) -o $@ $(RTQUERYOBJS) $(LDLIBS) -lresolv $(CTFMERGE_HOOK)
#	$(POST_PROCESS)

#lint:
#	$(LINT.c) $(ROUTEDSRCS) $(LDLIBS)
#	$(LINT.c) $(RTQUERYSRCS) $(LDLIBS)

#install:	all $(ROOTUSRSBINPROG) $(ROOTMANIFEST) $(ROOTSVCMETHOD)

#check:		$(CHKMANIFEST)

#clean:
#	$(RM) $(CLEAN_FILES)

#include		../../../Makefile.targ
